﻿@model Itfort.Web.PageResult
@{
	ViewBag.Title = "修改密码";
	Layout = "~/Views/Shared/_Layout.cshtml";

	ViewBag.CurrentNavItem = "Password";
}

<div class="index-title">
	<h3>与邮箱关联的登录密码，并非社交账号密码</h3>
</div>
@using (Html.BeginForm())
{
	<div class="formbox">
		@if (Model.Status == Itfort.Web.ResultStatus.Success)
  {
			<div class="ok">密码修改成功</div> 
  }
  else if (Model.Status == Itfort.Web.ResultStatus.Failure)
  {
			<div>@Model.FailureMessage</div>
  }

		<table class="form">
			<tr>
				<td>当前密码：</td>
				<td>
					<p>@Html.Password("password")</p>
					&nbsp;
				</td>
			</tr>
			<tr>
				<td>新密码：</td>
				<td>
					<p>@Html.Password("newPassword")</p>
					&nbsp;
				</td>
			</tr>
			<tr>
				<td>确认新密码：</td>
				<td>
					<p>@Html.Password("newPasswordAgain")</p>
					&nbsp;
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td>
					<input type="submit" value="确定" />
				</td>
			</tr>
		</table>
	</div>

}
@section BottomScripts {
	<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function () {
			$("form").validate({
				rules: {
					password: {
						required: true
					},
					newPassword: {
						required: true,
						rangelength: [6, 30]
					},
					newPasswordAgain: {
						required: true,
						equalTo: "#newPassword"
					}
				},
				messages: {
					password: {
						required: "请输入当前密码"
					},
					newPassword: {
						required: "请输入新密码",
						rangelength: "密码长度为6-30位"
					},
					newPasswordAgain: {
						required: "请确认新密码",
						equalTo: "两次密码输入不一致"
					}

				},
				errorPlacement: function (error, element) {
					error.appendTo(element.parent().parent());
				}
			});
		});
	</script>
}

